package com.s7.compat.status;

import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;

import androidx.annotation.ColorInt;

public class ColorManager {

    public static int toGrey(@ColorInt int color) {
        int blue = Color.blue(color);
        int green = Color.green(color);
        int red = Color.red(color);
        return (red * 38 + green * 75 + blue * 15) >> 7;
    }

    public static int toColorAlpha(@ColorInt int color, float transparent) {
        ColorDrawable drawable = new ColorDrawable(color);
        drawable.setAlpha((int) (drawable.getAlpha() * transparent));
        return drawable.getColor();
    }
}
